import React, {Component} from 'react';
import axios from 'axios';
import {Layout} from 'antd'
class MyHeader extends Component {
    constructor(props) {
        super(props);
        // 设置 initial state
        this.state = {
            userInfo: {}
        };
    }
    componentDidMount() {
        var _this = this;
        var token = $.cookie('token');
        var mytoken = JSON.parse(token);
        axios.defaults.headers.common['Authorization'] = "Bearer " + mytoken.access_token;
        axios
            .get('http://localhost:7952/api/Admin/GetAdminInfo')
            .then(function (response) {
                _this.setState({userInfo: response.data});
                var my = JSON.stringify(response.data);
                $.cookie('userInfo', my, {path: '/'});
            })
            .catch(function (response) {
                console.log(response);
            });
    }
    render() {
        return (
            <div id="stage-header">
                <header className="main-header">
                    <a href="index2.html" className="logo">
                        <span className="logo-mini">
                            < b >
                                S
                            </b>tage</span >
                        <span className="logo-lg">
                            < b >
                                Stage
                            </b>
                        </span >
                    </a>
                    < nav className="navbar navbar-static-top" role="navigation">
                        < a href="#" className="sidebar-toggle" data-toggle="offcanvas" role="button">
                            <span className="sr-only">
                                点击收起或展开1
                            </span>
                        </a >
                        < div className="navbar-custom-menu">
                            < ul className="nav navbar-nav">
                                < li className="dropdown messages-menu">
                                    < a href="#" className="dropdown-toggle" data-toggle="dropdown">
                                        < i className="fa fa-envelope-o"></i>
                                        < span className="label label-success">
                                            4
                                        </span>
                                    </a>
                                    < ul className="dropdown-menu">
                                        < li className="header">
                                            你有四个新通知
                                        </li>
                                        < li>
                                            < ul className="menu">
                                                < li>
                                                    < a href="#">
                                                        < div className="pull-left">
                                                            <img
                                                                className="img-circle"
                                                                alt="User Image"
                                                                src="http://localhost/userAvatar/1a02018c-839d-4fe9-bc5d-6547932d90a8.png"></img>
                                                        </div>
                                                        < h4>
                                                            发信人： 管理员 < small > < i className = "fa fa-clock-o" >
                                                        </i>
                                                        5 mins</small >
                                                </h4>
                                                <p >
                                                    请于下班前处理完你的订单
                                                </p>
                                            </a>
                                        </li>
                                    </ul>
                                </li>
                                <li className="footer">
                                    < a href="#">
                                        查看所有消息
                                    </a>
                                </li>
                            </ul>
                        </li>
                        < li className="dropdown notifications-menu">
                            < a href="#" className="dropdown-toggle" data-toggle="dropdown">
                                < i className="fa fa-bell-o"></i>
                                < span className="label label-warning">
                                    10
                                </span>
                            </ a>
                            < ul className="dropdown-menu">
                                < li className="header">
                                    您有十个未处理订单
                                </li>
                                < li>
                                    < ul className="menu">
                                        < li>
                                            < a href="#">
                                                < i className="fa fa-users text-aqua"></i>
                                                请您尽快处理！
                                            </a>
                                        </li>
                                    </ul>
                                </li>
                                < li className="footer">
                                    < a href="#">
                                        查看所有
                                    </a>
                                </li>
                            </ul>
                        </li>
                        < li className="dropdown user user-menu" id="user-info">
                            < a href="#" className="dropdown-toggle" data-toggle="dropdown">
                                <img
                                    className="user-image"
                                    alt="User Image"
                                    src="http://localhost/userAvatar/1a02018c-839d-4fe9-bc5d-6547932d90a8.png"></img>
                                < span className="hidden-xs">
                                    {this.state.userInfo.NickName}
                                </span>
                            </a>
                            <ul className="dropdown-menu">
                                < li className="user-header">
                                    <img
                                        className="img-circle"
                                        alt="User Image"
                                        src="http://localhost/userAvatar/1a02018c-839d-4fe9-bc5d-6547932d90a8.png"></img>
                                    < p>
                                        {this.state.userInfo.NickName}
                                        < small>
                                            2017 - 1 - 22
                                        </small>
                                    </p>
                                </li>
                                < li className="user-footer">
                                    < div className="pull-left">
                                        <a
                                            href="http://localhost:27651/Home/Index#/PersonalCenter"
                                            className="btn btn-default btn-flat">
                                            个人中心
                                        </a>
                                    </div >
                                    < div className="pull-right">
                                        < a href="#" className="btn btn-default btn-flat">
                                            注销
                                        </a>
                                    </div>
                                </li>
                            </ul >
                        </li>
                    </ul>
                </div>
            </nav >
        </header>
    </div>
        )
    }
}
export default MyHeader;